﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 抽象工厂模式.Models
{
    /// <summary>
    /// 用户类
    /// </summary>
    public class User
    {
        int id;

        public int Id
        {
            get { return id; }
            set { id = value; }
        }
        string name;

        public string Name
        {
            get { return name; }
            set { name = value; }
        }

    }
    /// <summary>
    /// Iuser(用户)接口，用于客户端访问
    /// </summary>
    interface IUser
    {
        void insert(User user);
        User GetUser(int id);
    }
    class sqlUser : IUser
    {
        public void insert(User user)
        {
            Console.WriteLine("在SQL Server中给User表增加一条记录。");
        }
        public User GetUser(int id)
        {
            Console.WriteLine("在SQL Server中根据ID得到User表的一条记录。");
            return null;
        }
    }
    class AccessUser : IUser
    {
        public void insert(User user)
        {
            Console.WriteLine("在Access中给User表增加一条记录。");
        }
        public User GetUser(int id)
        {
            Console.WriteLine("在Access中根据ID得到User表的一条记录。");
            return null;
        }
    }

}
